home *** CD-ROM | disk | FTP | other *** search
- import java.awt.image.MemoryImageSource;
-
- public class TearTransition extends BannerTransition {
- static final float INITIAL_X_CROSS = 1.6F;
- static final float X_CROSS_DIVISOR = 3.5F;
- float xCross;
-
- public TearTransition() {
- super.numOfFrames = 7;
- }
-
- public void finishInit() {
- System.arraycopy(super.owner.banners[super.owner.currentBanner].imagePixels, 0, super.workPixels, 0, super.imageWidth);
- System.arraycopy(super.owner.banners[super.owner.nextBanner].imagePixels, super.imageWidth, super.workPixels, super.imageWidth, super.pixelsPerImage - super.imageWidth);
- this.xCross = 1.6F;
-
- for(int i = super.numOfFrames - 1; i >= 0; --i) {
- try {
- Thread.sleep(100L);
- } catch (InterruptedException var6) {
- }
-
- this.Tear();
-
- try {
- Thread.sleep(150L);
- } catch (InterruptedException var5) {
- }
-
- super.frames[i] = super.owner.createImage(new MemoryImageSource(super.imageWidth, super.imageHeight, super.workPixels, 0, super.imageWidth));
- super.owner.prepareImage(super.frames[i], super.owner);
- this.xCross /= 3.5F;
- }
-
- super.workPixels = null;
- }
-
- public void Tear() {
- int heightAdder;
- int p = heightAdder = super.imageWidth;
-
- for(int y = 1; y < super.imageHeight; ++y) {
- float hMulti = this.xCross * (float)y;
- if (hMulti >= 0.5F) {
- float fx = 0.0F;
- ++hMulti;
- int x = 0;
-
- do {
- super.workPixels[p++] = super.owner.banners[super.owner.currentBanner].imagePixels[heightAdder + x];
- x = (int)(fx += hMulti);
- } while(x < super.imageWidth);
- } else {
- float overflow = 1.0F / hMulti;
- float dstEnd = overflow / 2.0F + 1.5F;
- int dstStart = 0;
- int src_offset = 0;
-
- for(int length = (int)dstEnd; dstStart + src_offset + length < super.imageWidth; length = (int)dstEnd - dstStart) {
- System.arraycopy(super.owner.banners[super.owner.currentBanner].imagePixels, p + src_offset, super.workPixels, p, length);
- ++src_offset;
- dstEnd += overflow;
- p += length;
- dstStart += length;
- }
-
- int var13 = super.imageWidth - src_offset - dstStart;
- System.arraycopy(super.owner.banners[super.owner.currentBanner].imagePixels, p + src_offset, super.workPixels, p, var13);
- }
-
- p = heightAdder += super.imageWidth;
- }
-
- }
- }
-